import { Controller, Post, Body, Header, Headers, HttpCode, HttpStatus } from '@nestjs/common';
import { AuthService } from './auth.service';
import { LoginDto } from './auth.dto'


@Controller('auth')
export class AuthController {
  constructor(private readonly authService: AuthService) { }

  @Post('oauth2/token')
  login(@Body() loginDto: LoginDto, @Headers() headers) {
    const { username, password } = loginDto
    return this.authService.login(username, password, headers);
  }

  @Post('token/logout')
  logout() {
    return this.authService.logout();
  }

  @HttpCode(HttpStatus.OK)
  @Header('Content-Type', 'image/svg+xml')
  @Post('token/verificationcodeCreate')
  verificationcodeCreate() {
    return this.authService.verificationcodeCreate();
  }
}


